package q1.project.core.entity;

import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import q1.project.core.jpa.annotation.Comment;

import java.time.LocalDateTime;

/**
 * @author sun
 * @date 2025/11/28 00:35
 */
@Getter
@Setter
@MappedSuperclass
public class BaseCreateAndUpdateEntity extends BaseCreateEntity{
    @Column(columnDefinition = "varchar(100) COMMENT '最后修改人Id'", insertable = false)
    @LastModifiedBy
    @Comment("修改人id")
    private String updateById;

    @LastModifiedDate
    @Column(insertable = false)
    @Comment("修改时间")
    private LocalDateTime updateTime;

    @Override
    public String toString() {
        return "BaseCreateAndUpdateEntity{" +
                "updateById='" + updateById + '\'' +
                ", updateTime=" + updateTime +
                "} " + super.toString();
    }
}
